import zh from './zh';
import en from './en';
import {LangUtils} from "@/utils/LangUtils";
import {LangEnum} from "@/typing/lang";


function getLangConf(lang: LangEnum) {
    switch (lang) {
        case LangEnum.zh:
            return zh;
        case LangEnum.en:
            return en;
        default:
            return zh;
    }
}

const lang = LangUtils.getLang();
const langConf = getLangConf(lang);


export const i18n = new Proxy(zh, {
    get(target: typeof zh, propKey: string | symbol, receiver: any): any {
        // @ts-ignore
        return langConf[propKey];
    }
})
